package com.zh.test.service;

import com.zh.test.bean.OuterBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface testMapper {
    @Select("select *  from bi_record_change")
   // @inventoryHistory  AOP的切入类型,注解
    List<Map<String, Object>> test1();

    @Select("select * from bi_record_change where id = #{id}")
    Map<String, Object> test2(@Param("id")String id);

    @Select("select * from bi_record_change where id = #{out.innerBean.id}")
    Map<String, Object> test3(@Param("out")OuterBean bean);


    @Select("<script>" +
            "select * from bi_record_change where 1=1 " +
            "<if test='out.innerBean.id !=null and out.innerBean.id !=\"\" '> or id =#{out.innerBean.id}</if>" +
            "<if test='out.innerBean.resourceId !=null and out.innerBean.resourceId !=\"\" '> or resource_id =#{out.innerBean.resourceId}</if>" +
            "</script>")
    List<Map<String, Object>> test4(@Param("out")OuterBean bean);



}
